import { configureStore } from '@reduxjs/toolkit';
import userReducer from './userReducer';
import componentReducer from './componentReducer';
import pageInfoReducer from './pageInfoReducer';
import undoable, { excludeAction } from 'redux-undo';
export const store = configureStore({
  reducer: {
    user: userReducer,
    //没有添加 undo
    // components: componentReducer,
    //添加 undo
    components: undoable(componentReducer, {
      limit: 20,
      filter: excludeAction([
        'components/resetComponents',
        'components/changeSelectedId',
        'components/selectPreComponent',
        'components/selectPreComponent',
      ]),
    }),
    pageInfo: pageInfoReducer,
  },
});
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
